﻿//检测页面是否有访问权限
//pageNo 传输页面编号 数据库内 pathLevel 页面相对 Service/Basic/ChekPageRight.ashx 方法的级别
function ChekPageRight(pageNo, pathLevel) {
    var RTUrl = "";
    var NoRightUrl = "";
    var ChekPageUrl = "";
    for (var I = 0; I < pathLevel; I++) {
        RTUrl += "../";
        NoRightUrl += "../";
        ChekPageUrl += "../";
    }
    RTUrl += "Service/Basic/Page/ChekRight.ashx";
    NoRightUrl += "WebSite/Branch/NoRight.html";
    ChekPageUrl += "WebSite/Branch/ChekPage.html?PageNo=" + pageNo + "&RetUrl=" + $MRT.URL();
    var RTData = "PageNo=" + pageNo;
    //异步还是同步请求，同步可卡死访问页面后操作,如果需要异步 则将false设为true
    $MRT.Ajax(false, RTUrl, RTData, function (xmlData) {
        var Json = $MJO.GetObject(xmlData);
        if (Json == null || Json.Successful == false) {
            //switch (Json.Code) {
            //    case 10000:
            //        $MRT.Redirect(NoRightUrl);
            //        break; //无权
            //    case 11100:
            //        $MRT.Redirect(ChekPageUrl);
            //        break; //需验证密码
            //    default:
            //        $MRT.Redirect(NoRightUrl);
            //        break;
            //}
        }
        else { /*成功*/ }
    });
}